DEBUG refinements#652
Conversation
climbfuji
left a comment
There was a problem hiding this comment.
This looks good, just a few minor corrections. Thanks for your efforts!
Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>
|
@dustinswales I am happy to approve this PR now, but I am wondering if it's still needed given #651? |
|
@DomHeinzeller After discussion in #651, the preferable solution is to redo this one debug check to check the length of each dimension, and not use the bounds of the array. This will take some work, and I will not be able to get to this for a few days. |
|
Ok, thanks. Please ping me when the revised version of this PR is ready. |
|
When these changes are done, I think an adjustment of the Input/Output Variable (argument) Rules is in order. One idea is to modify the warning and example to: |
… feature/debug_refinements
…swales/ccpp-framework into feature/debug_refinements
|
@gold2718 I've made the discussed modifications. This is ready for review @climbfuji @peverwhee |
gold2718
left a comment
There was a problem hiding this comment.
The code looks okay now but I did not see any check for failure. Is there a test showing proper output is triggered when an array fails the check?
I tried changing one of the dimensions of var_array in capgen_test/test_host_mod and the test still passes. Is that expected? capgen was called with the --debug flag.
Is this a valid test?
|
@gold2718 I can't figure out how to trigger these errors!?! I haven't really thought hard about this, but do we need these size checks at all? |
The purpose of this is not to check if the metadata is consistent between host and scheme. It's to check if the allocation of the variable by the host is different than what the metadata says. |
See how var_array is being passed into the suite cap from test_host_ccpp_cap.F90: |
|
@gold2718 @DomHeinzeller @dustinswales I have opened a PR for changing the tech doc with the suggested wording: NCAR/ccpp-doc#75 |
This is not correct. Upon subroutine entry, an |
|
@gold2718 I am referring to this situation of which there are probably more than 100 in the current ccpp-physics: ( with result This is how the intent is used in the ccpp-physics and ccpp-framework (prebuild) as of today. If something is intent(out), then it means the data must be overwritten entirely, it does not imply or even allow a reallocation of the array. Remember that in the good old days, the rule was that the host model is responsible for ALL memory management. |
@climbfuji This was my understanding. |
Thanks for the example, I now see we are talking about different things. You are talking about a regular, which would not work!
How would you test that? There is nothing in Fortran (aside from possible compiler warnings) that enforces that. In your example, if you change the assignment to |
|
This is not about testing whether the data must be overwritten entirely. This is about having to test the allocation of the array if allocated by the host model, regardless of whether the intent is in, inout, or out (in reply to comment #652 (comment)). And also, you can catch the missing assignment of data to an intent(out) array quite easily with generated code. For example, when debug checks are enabled, every array that is declared as intent(out) can be assigned a value that would either cause a runtime error if being used in the scheme, or that can be tested for after the scheme was called. |
I guess that is why I am confused. I did call for testing all "host model" |
This is only the case if you reserve one or more values to the CCPP Framework. Otherwise, a scheme could use any value (including One candidate that might be acceptable is |
I was thinking the same, yes! |
gold2718
left a comment
There was a problem hiding this comment.
This is basically okay (for now) but could use some cleanup.
- The PR description is now out of date
- Please clean debug stings out of comments.
… feature/debug_refinements
@gold2718 Not that I recall. |
|
@gold2718 @climbfuji @peverwhee
|
Thanks @dustinswales, this all looks good to me. Happy to proceed with merging the PR as it is now. |
|
@dustinswales looks good to me! |
Per discussion at NCAR/ccpp-framework#652 (comment)


This PR contains changes for the DEBUG tests.
Add functionality within the DEBUG checks to:
User interface changes?:
No
Fixes: #649 #650 #651 #652